demointro:
.asciiz "\nTime to start the demo. Do you...\n1. Use the VGA screen to make a really awsome game.\n2. Use the LED lights and switches to make a Whack-a-Mole game.\n3. Sit back and let someone else deal with the programing."

faggot1:
.asciiz "\nYou try and use the VGA to output to a screen... You fail miserably, but you can make the screen rotate between 2 different colors congratulations you lose!"

watchawhacka:
.asciiz "\nCongratulations someone else designed Whack-an-LED and it is a great success. You have passed phasse 3 with no problem. Move on to the final round." 

whacka:
.asciiz "\nCongratulations Whack-an-LED is a great success. You have passed phasse 3 with no problem. Move on to the final round." 
demo1:
	li $a0, demointro
	jal libplp_uart_write_string
	nop
	
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, faggot
	nop
	
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, mole
	nop

		move $t0, $v0
	li $t1, 0x00000033
	beq $t0, $t1, demo3
	nop
	
	mole:
	li $a0, whacka
	jal libplp_uart_write_string
	nop	
	li $s5, 0x00000004
	j boss_encounter
	nop

demo3:
	li $a0, watchawhacka
	jal libplp_uart_write_string
	nop	
	li $s5, 0x00000004
	j boss_encounter
	nop	
	
faggot:
	li $a0, faggot1
	jal libplp_uart_write_string
	nop
	
libplp_vga_enable:
	lui $t0, 0xf040
	ori $t1, $t0, 1
	jr  $ra
	sw  $t1, 0($t0)

libplp_vga_disable:
	lui $t0, 0xf040
	jr  $ra
	sw  $zero, 0($t0)

libplp_vga_framebuffer:
	lui $t0, 0xf040
	jr  $ra
	sw  $a0, 4($t0)

libplp_vga_clear:
	lui $t0, 0xf040
	lw  $t1, 4($t0) #framebuffer location
	li  $t2, 0x4b000
	addu $t2, $t2, $t1 #upper bound
libplp_vga_clear_loop:
	sw $a0, 0($t1)
	addiu $t1, $t1, 4
	bne $t1, $t2, libplp_vga_clear_loop
	nop
	jr $ra
	nop

	jal libplp_vga_enable
	nop
	
	li $a0, 0x10f00000
	jal libplp_vga_framebuffer
	nop

loop:
	li $a0, 0xd3d3d3d3
	jal libplp_vga_clear
	nop

	li $a0, 0x02020202
	jal libplp_vga_clear
	nop
	
	j loop
	nop

	
	
	
	
	
	
	
	
	
	
	